﻿var offerSwiper = new Swiper('#swiper-container-offer', {
    speed: 750,
    autoplay: 5000,
    loop: true,
    grabCursor: true
});
$('.arrow-left').on('click', function (e) {
    e.preventDefault();
    offerSwiper.swipePrev();
});
$('.arrow-right').on('click', function (e) {
    e.preventDefault();
    offerSwiper.swipeNext();
});

$(document).ready(function () {

    $('#submitButton').on('click', function () {
        var email = $('#write').text();
        if ($.trim(email).length == 0) {
            alert('Пожалуйста введите корректный email');
            return false;
        }
        $(function () {
            $('#notifyModal').modal('toggle');
        });
        var jsonData = "{ 'write': '" + $("#write").val() + "', 'size':'" + $("#Size").val() + "', 'modelId': " + $("#ModelId").val() + ", 'shopId': " + $("#ShopId").val() + "}";
        $.ajax({
            url: "/Admin/Subscribe",
            dataType: "json",
            type: "POST",
            data: jsonData,
            contentType: "application/json; charset=utf-8"
        });
        alert("Спасибо");
        $('#write').text("");
        return false;
    });

    function goMain() {
        window.location.href = "/";
    };
    var timer = setTimeout(goMain, 60000 * 5);
    $(document).on('mousemove', function () {
        clearTimeout(timer);
        timer = setTimeout(goMain, 60000 * 5);
    });
});



